<?php
namespace Kuoqi\Model\Model;

/**
 * 数据验证模块的相关信息开发
 * Class FilterModel
 * @package Kuoqi\Model\Model
 */
class FilterModel{

    static public function Filter($code,$data){
        switch(strtolower($code)){
            case 'require':return self::FilterRequire($data);
            case 'int':return self::FilterIntval($data);
            case 'intval':return self::FilterIntval($data);
            default:return $data;
        }
    }

    //判定是否为必填
    static public function FilterRequire($stream){
        if(strlen($stream)){
            return $stream;
        }else{
            return null;
        }
    }
    //判定为intval
    static public function FilterIntval($stream){
        return intval($stream);
    }
}